<html>
<head>
<title>异想之旅聊天</title>
</head>
<body>
接受信息：
<table border="0">
<tr>
  <td><input type="text" id="havename" placeholder="接受人"></td>
  <td><input type="text" id="havepswd" placeholder="接受人密码"></td>
</tr>
<tr>
  
  <td><button id="have" type="button">接受</button></td>
</tr>
<tr>
  <td colspan=2><span id="mframe" style="width:100%;height:200px"></span></td>
</tr>
</table>

<script type="text/javascript" src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
<script>
$('#have').on('click',function(){
    //document.getElementById("mframe").src = "/have/"+document.getElementById("havename").value+"/"+document.getElementById("havepswd").value+"#bottom";
    data={"havename": document.getElementById("havename").value,
    "havepswd": document.getElementById("havepswd").value}
    
    $.ajax({
    type: 'post',
    url: "/have",
    data: JSON.stringify(data), 
    contentType: 'application/json; charset=UTF-8',
    dataType: 'text', 
    success: function(data) {
        //alert(data);
        document.getElementById("mframe").innerHTML=data;
    },
    error: function(xhr, type) {alert(type);}
    });
    
    //document.getElementById("mframe").reload();
});
</script>
</body>
</html>